package Bk.basic;

public class Charge {

	public static void main(String[] args) {
		// 잔돈 계산하는 프로그램
		int charge;
		int w10;
		int w50;
		int w100;
		int w500;
		int w1000;
		int w5000;
		int w10000;
		int w50000;
		int rest;
		
//		charge = 876543210;
		charge = 8_7654_3210;        //JDK7, 자릿수 구분 _
		w50000 = charge / 5_0000;
		rest = charge - (w50000 * 5_0000);
		w10000 = rest / 1_0000;
		
		rest = rest - (w10000 * 1_0000);
		w5000 = rest / 5000;
		
		rest = rest - (w5000 * 5000);
		w1000 = rest / 1000;
		
		rest = rest - (w1000 * 1000);
		w500 = rest / 500;
		
		rest = rest - (w500 * 500);
		w100 = rest / 100;
		
		rest = rest - (w100 * 100);
		w50 = rest / 50;
		
		rest = rest - (w50 * 50);
		w10 = rest / 10;
		
		System.out.println(charge);
		System.out.println(w50000);
		System.out.println(w10000);
		System.out.println(w5000);
		System.out.println(w1000);
		System.out.println(w500);
		System.out.println(w100);
		System.out.println(w50);
		System.out.println(w10);
		
		
	}

}
